home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / DCLAP 4j / DClap / DApplication.h < prev    next >
Encoding:
Text File  |  1995-12-17  |  3.0 KB  |  91 lines  |  [TEXT/R*ch]

  1. // DApplication.h
  2. // d.g.gilbert
  3.  
  4. #ifndef _DAPPLICATION_
  5. #define _DAPPLICATION_
  6.  
  7. #include "DTaskMaster.h"
  8.  
  9. class DWindow;
  10. class DMenu;
  11. class DFile;
  12.  
  13. class DApplication : public DTaskMaster
  14. {    
  15. public:
  16.     enum filetasks {cFileMenu=40, kAbout,kNew,kOpen,kClose,kSave,kSaveAs,kPrint,kHelp,kQuit};
  17.     enum edittasks {cEditMenu=60, kUndo,kCut,kCopy,kPaste,kClear,kSelectAll,kShowClipboard,
  18.                                     kFind,kFindAgain};
  19.     enum windowtasks {cWindowMenu= 80, kPrevWindow,kNextWindow,kChooseWindow,kDeleteDeadWindow};
  20.     
  21.     static char* kName;
  22.     static char* kVersion;
  23.     static char* kHelpfolder;
  24.     static short HandleSpecialEvent( long inEvent, long outReply, long inNumber);
  25.  
  26.     Boolean fDone;                                // true when Quit requested...
  27.     char* fPathname;
  28.     char* fShortname;
  29.     char* fAboutLine;
  30.     DWindow* fAppWindow;
  31.     char*    fAcceptableFileTypes;    // mac, ?? other file type ids
  32.     char*    fFileSuffix;                    // unix, msdos file suffix
  33.     
  34.     DApplication();
  35.     ~DApplication();    
  36.     void IApplication(const char* theAppName = NULL);
  37.     
  38.     virtual void    Run(void);
  39.     virtual void    MainEventLoop(void);
  40.     virtual void    ProcessTasks(void);
  41.     //virtual void    Idle(EventRecord *macEvent);
  42.     virtual    void    Quit(void);
  43.     
  44.     virtual const char*    Pathname(void);
  45.     virtual const char*    Shortname(void);
  46.  
  47.     virtual Boolean IsMyAction(DTaskMaster* action); // override 
  48.     virtual Boolean    DoMenuTask( long tasknum, DTask* theTask);
  49.     virtual DMenu*  NewMenu(long id, char* title);
  50.     virtual void    UpdateMenus(void);
  51.     virtual void    SetUpMenus(void);
  52.     virtual void  SetUpMenu(short menuId, DMenu*& aMenu); 
  53.     virtual void    DoAboutBox(void);
  54.     virtual void     DoHelp(void);
  55.     virtual void  OpenHelp(DFile* aFile);
  56.     virtual void  OpenHelp(const char* helpname);
  57.     virtual void    SetAppMenuWindow(DWindow* itsWindow);
  58.  
  59.     virtual void  InitSpecialEvents();  // == AppleEvents for Mac
  60.  
  61.     virtual char*    GetPref(char* type, char* section = "general", char* defaultvalue = NULL);
  62.     virtual long    GetPrefVal(char* type, char* section = "general", char* defaultvalue = NULL);
  63.     virtual char*    GetPrefSection(char* section, ulong& sectlen, char* defaultvalue = NULL);
  64.     virtual char* GetFilePref(char* type, char* section = "general", char* defaultvalue = NULL);
  65.     virtual char* ConvertStdFilePath(char* pathname);
  66.     
  67.     virtual Boolean SetPref(char* prefvalue, char* type, char* section = "general");
  68.     virtual Boolean SetPref(long prefvalue, char* type, char* section = "general");
  69.     virtual Boolean InstallDefaultPrefs(const char* defaultSuffix= ".prefs", const char* appName= NULL); // use appName==ShortName()
  70.     
  71.     virtual    Boolean ChooseFile(DFile*& openedFile, char* filesuffix, char* acceptableTypeIDs);
  72.     virtual void OpenDocument(DFile* aFile);
  73.     virtual void OpenDocument(char* pathname);
  74.  
  75.     //virtual void    CreateDocument(void);
  76.     //virtual void OpenNew(long itsCommandNumber);
  77.     //virtual void OpenOld(long itsOpenCommand, DList* aFileList);
  78.     //virtual void PrintDocuments(DList* aFileList);
  79.  
  80.         // should these be integrated w/ DTaskMaster/DTaskCentral, as TasksAvail() ????
  81.     Boolean    EventsAvail();
  82.     void    FlushEvents();
  83.  
  84. };
  85.  
  86.  
  87. extern DApplication* gApplication;        // the current application object
  88.  
  89.  
  90. #endif
  91.